package com.tianji.learning.controller;

import com.tianji.api.client.remark.RemarkClient;
import com.tianji.api.dto.remark.LikeRecordFormDTO;
import com.tianji.common.utils.BeanUtils;
import com.tianji.learning.dto.LikedDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 点赞记录表 控制器
 * </p>
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/likes")
@Api(tags = "点赞业务相关接口")
public class LikedRecordController {

    private final RemarkClient remarkClient;

    @PostMapping
    @ApiOperation("点赞或取消点赞")
    public void addLikeRecord(@RequestBody LikedDto dto) {
        LikeRecordFormDTO vo = new LikeRecordFormDTO();
        vo.setBizId(Long.valueOf(dto.getId()));
        vo.setLiked(dto.getLiked());
        vo.setBizType("QA");
        remarkClient.addLikeRecord(vo);
    }
}